package pl.edu.agh.bd2.domain;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;

@Entity
@Table(name="teacher")
@PrimaryKeyJoinColumn(name="id")
public class Teacher extends User {
	
	@Column(name="firstname")
	@Length(max=30)
	private String firstName;
	
	@Column(name="lastname")
	@Length(max=30)
	private String lastName;
	
	@Column(name="address")
	@Length(max=100)
	private String address;
	
	@Column(name="title")
	@Length(max=20)
	private String title;
	
	
	@OneToMany(mappedBy="teacher")
	private Set<Subject> subjects;

	protected Teacher() {
	}

	public Teacher(String login, String password, String role,
			String contactEMail, String phoneNumber, String firstName,
			String lastName, String address, String title, Set<Subject> subjects) {
		super(login, password, role, contactEMail, phoneNumber);
		this.firstName = firstName;
		this.lastName = lastName;
		this.address = address;
		this.title = title;
		this.subjects = subjects;
	}
	
	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Set<Subject> getSubjects() {
		return subjects;
	}

	public void setSubjects(Set<Subject> subjects) {
		this.subjects = subjects;
	}

	public Subject[] findSubject(String aName) {
		throw new UnsupportedOperationException();
	}

	public void addSubject(Subject aSubject) {
		subjects.add(aSubject);
	}

	public void removeSubject(Subject aSubject) {
		throw new UnsupportedOperationException();
	}
}